from base.request_new import RequestNew
from business.ssologin.login import user_login


class DeployerTools:

    def __init__(self):
        cookie = user_login()
        self.host = None
        self.service_id = None
        self.method_id = None
        self.rt = RequestNew(cookie=cookie)

    def add_grading_rank(self, user_id, grading_num,
                         br_product_subtype="",
                         periodical_id="",
                         grade="",
                         subject=""):
        req = {
            "url": f"{self.host}/",
            "data": {},
            "method": "POST",
            "content_type": "FORM",
            "ignore": True
        }
        r, v = self.rt.request_auto(**req)
        return r


if __name__ == '__main__':
    d = DeployerTools()
    d.host = ""
    d.service_id = ""
    d.method_id = 0

    for i in range(1, 100000):
        r = d.add_grading_rank(user_id=i, grading_num=i)
        if not isinstance(r, int):
            break
        if r != i:
            break
